package com.noyes4j.ota.service.impl;

import com.noyes4j.common.core.text.Convert;
import com.noyes4j.common.utils.DateUtils;
import com.noyes4j.ota.domain.SysAuthorization;
import com.noyes4j.ota.mapper.SysAuthorizationMapper;
import com.noyes4j.ota.service.ISysAuthorizationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName SysAuthorizationServiceImpl
 * @Description: TODO
 * @Author zhaoweiqin
 * @Date 2021/1/29
 * @Version V1.0
 **/
@Service
public class SysAuthorizationServiceImpl  implements ISysAuthorizationService {

    @Autowired
    private SysAuthorizationMapper sysAuthorizationMapper;

    /**
     * 查询授权
     *
     * @param id 授权ID
     * @return 授权
     */
    @Override
    public SysAuthorization selectSysAuthorizationById(Long id)
    {
        return sysAuthorizationMapper.selectSysAuthorizationById(id);
    }

    /**
     * 查询授权列表
     *
     * @param sysAuthorization 授权
     * @return 授权
     */
    @Override
    public List<SysAuthorization> selectSysAuthorizationList(SysAuthorization sysAuthorization)
    {
        return sysAuthorizationMapper.selectSysAuthorizationList(sysAuthorization);
    }

    /**
     * 新增授权
     *
     * @param sysAuthorization 授权
     * @return 结果
     */
    @Override
    public int insertSysAuthorization(SysAuthorization sysAuthorization)
    {
        sysAuthorization.setCreateTime(DateUtils.getNowDate());
        return sysAuthorizationMapper.insertSysAuthorization(sysAuthorization);
    }

    /**
     * 修改授权
     *
     * @param sysAuthorization 授权
     * @return 结果
     */
    @Override
    public int updateSysAuthorization(SysAuthorization sysAuthorization)
    {
        sysAuthorization.setUpdateTime(DateUtils.getNowDate());
        return sysAuthorizationMapper.updateSysAuthorization(sysAuthorization);
    }

    /**
     * 删除授权对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSysAuthorizationByIds(String ids)
    {
        return sysAuthorizationMapper.deleteSysAuthorizationByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除授权信息
     *
     * @param id 授权ID
     * @return 结果
     */
    @Override
    public int deleteSysAuthorizationById(Long id)
    {
        return sysAuthorizationMapper.deleteSysAuthorizationById(id);
    }

}
